﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace iri10
{
    public partial class frmMain : Form
    {
        private int childFormNumber = 0;

        public frmMain()
        {
            InitializeComponent();
        }

        private void ShowNewForm(object sender, EventArgs e)
        {
            Form childForm = new Form();
            childForm.MdiParent = this;
            childForm.Text = "Window " + childFormNumber++;
            childForm.Show();
        }

        private void ExitToolsStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

         private void CascadeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.Cascade);
        }

        private void TileVerticalToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.TileVertical);
        }

        private void TileHorizontalToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.TileHorizontal);
        }

        private void ArrangeIconsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.ArrangeIcons);
        }

        private void CloseAllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form childForm in MdiChildren)
            {
                childForm.Close();
            }
        }

        private void picBuscarPedido_Click(object sender, EventArgs e)
        {
            //Login
            NegVentanas.showBuscarPedido();

        }

        private void picLogin_Click(object sender, EventArgs e)
        {
            NegVentanas.showLogIn();
        }

        private void picBack_Click(object sender, EventArgs e)
        {

        }

        public void logIn()
        {
            //Se deslogueo
            if (usuarioActual.User == null)
            {
                picUser.Image = null;
                picLogin.Image = picCandadoCerrado.Image;
                lblLogin.Text = "Autenticarse";
                lblUser.Text = "";
                lblWelome.Text = "";
                return;
            }
            picLogin.Image = picCandadoAbierto.Image;
            lblLogin.Text = "Salir";

            //Cambio el dibujito según quien este logueado
            if (usuarioActual.User.SSexo.CompareTo("F") == 0)
                picUser.Image = picMujer.Image;
            else
                picUser.Image = picHombre.Image;

            lblUser.Text = usuarioActual.User.SNombreUsuario;
            lblWelome.Text = "Bienvenido";
        }

        private void frmMain_Load(object sender, EventArgs e)
        {
            lblWelome.Text = "";
            lblUser.Text = "";
        }


        


        private void picComprar_Click(object sender, EventArgs e)
        {
            NegVentanas.showSeleccionarTipo();
        }

        private void panel1_Paint(object sender, PaintEventArgs e)
        {

        }

    }
}
